SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
CREATE VIEW dbo.vw_listadofinalinterinosytitulares
AS
SELECT DISTINCT *
FROM         dbo.vw_POFPaquete
WHERE     (CUPOF IN
                          (SELECT DISTINCT i.cupof
                            FROM          interinos i INNER JOIN
                                                   titulares t ON i.cupof = t.cupof where i.agente <> t.agente)) AND (SR IN ('t', 'i') )

GO
